﻿<UserControl x:Class="ParseOnlineAdmin.ParseRelatedFiles"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:local="clr-namespace:ParseOnlineAdmin"
			 mc:Ignorable="d" d:DesignHeight="150" d:DesignWidth="300">

    <UserControl.Resources>

        <local:ParseObjectToStringConverter x:Key="valueConverter" />

        <SolidColorBrush x:Key="transp" Color="Transparent"  Opacity="0" />
        <SolidColorBrush x:Key="snow" Color="Transparent" Opacity="0.0001" />
        <SolidColorBrush  x:Key="light"  Color="White" Opacity="0.35" />
        <SolidColorBrush x:Key="over" Color="White"  Opacity="0.50" />
        <SolidColorBrush x:Key="selected"  Color="White"  Opacity="0.75" />

        <DropShadowEffect x:Key="shadowDark" BlurRadius="8" 
					  ShadowDepth="3" Color="#777777" 
				Direction="270" RenderingBias="Performance" />

        <!-- FocusVisual -->
        <Style x:Key="SimpleFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border
						BorderBrush="Transparent"
						BorderThickness="0"
						SnapsToDevicePixels="true">
                            <!--
							<Border.Effect>
							<DropShadowEffect ShadowDepth="0"
							Color="Gray"
							BlurRadius="5" />
							</Border.Effect>
						-->
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="listboxitem" TargetType="ListBoxItem">
            <Setter Property="Opacity" Value="0" />
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
            <Setter Property="RenderTransform">
                <Setter.Value>
                    <TranslateTransform Y="-10" />
                </Setter.Value>
            </Setter>
            <Setter Property="FocusVisualStyle" Value="{StaticResource SimpleFocusVisual}" />
            <Setter Property="BorderBrush" Value="#fff" />
            <Setter Property="BorderThickness" Value="0,0,0,1" />
            <Setter Property="Foreground" Value="#fff" />
            <Setter Property="Background" Value="{StaticResource transp}" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border x:Name="root" BorderBrush="#333" BorderThickness="1" Background="#555">

                            <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">

                                <Rectangle x:Name="rectBg" SnapsToDevicePixels="true" 
										   Effect="{StaticResource shadowDark}" />

                                <ContentPresenter Margin="0" HorizontalAlignment="Stretch"
									Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
									SnapsToDevicePixels="true" />
                            </Grid>
                        </Border>

                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="Loaded">
                                <BeginStoryboard>
                                    <Storyboard Storyboard.DesiredFrameRate="30">
                                        <DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
										Duration="0:0:0.7" From="0"
										Storyboard.TargetProperty="Opacity" To="1" />
                                        <DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
										Duration="0:0:0.7" From="-10"
										Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
										To="0" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                            <Trigger Property="IsSelected" Value="True">
                                <!--<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="Fill" TargetName="rectBg" Value="#007ACC" />-->
                                <Setter Property="TextBlock.Foreground" Value="#fff" />
                            </Trigger>
                            <!--<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="False" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="BorderThickness" TargetName="line" Value="0,0,0,1" />
								<Setter Property="BorderBrush" TargetName="line" Value="#007ACC" />
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Fill" TargetName="rectBg" Value="#fff" />
								<Setter Property="Opacity" TargetName="rectBg" Value="0.5" />
							</MultiTrigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="True" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
							</MultiTrigger>-->
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Background" Value="Silver" />
                    <Setter Property="Foreground" Value="White" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="listbox" TargetType="{x:Type ListBox}">
            <Setter  Property="BorderThickness"  Value="0" />
            <Setter  Property="Margin"  Value="0" />
            <Setter  Property="Padding"  Value="0" />
            <Setter Property="Background"  Value="{StaticResource snow}" />
        </Style>
        <Style x:Key="textbox" TargetType="{x:Type TextBox}">
            <Setter Property="Background" Value="{StaticResource light}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Padding" Value="3" />
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Background" Value="{StaticResource over}" />
                    <Setter  Property="BorderThickness"  Value="0" />
                </Trigger>
                <Trigger  Property="IsFocused" Value="true">
                    <Setter  Property="Background" Value="{StaticResource selected}" />
                    <Setter  Property="BorderThickness" Value="0" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>


    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!--<TextBlock Text="Dateien" FontWeight="Bold" Margin="5" Grid.Row="0" />-->

        <Border x:Name="borderDragDrop" Background="#ff777777"
				PreviewDragEnter="FileBorder_PreviewDragEnter"
				PreviewDrop="FileBorder_PreviewDrop" 
				Margin="5" Grid.Row="1" AllowDrop="True" ClipToBounds="True">
            <Grid>
                <Rectangle Stroke="#999" StrokeThickness="3" StrokeDashArray="4 2" />
                <TextBlock Text="drop file here..." Margin="10" 
                           Foreground="#999" FontSize="14" FontWeight="Bold" />
            </Grid>
        </Border>

        <ListBox Margin="5"  Grid.Row="2" ItemContainerStyle="{StaticResource listboxitem}"
					 Style="{StaticResource listbox}"
						ItemsSource="{Binding Path=RelatedFileItems, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
									ScrollViewer.HorizontalScrollBarVisibility="Hidden"
									ScrollViewer.VerticalScrollBarVisibility="Auto"
									SelectedItem="{Binding Path=SelectedRelatedFile, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="2">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Border Height="30" Width="30" Grid.Column="0"	Grid.Row="0">
                            <Viewbox>
                                <Canvas Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" Margin="-10">
                                    <Path x:Name="Cutter" Width="58.832" Height="38" Canvas.Left="13" Canvas.Top="18" Stretch="Fill" 
                                          Fill="#FFffffff" Data="F1 M 16,25.0001L 29.9999,25.0001C 31.6568,25.0001 32.9999,26.3433 32.9999,28.0001C 32.9999,29.657 31.6568,31.0001 29.9999,31.0001L 16,31.0001C 14.3432,31.0001 13,29.657 13,28.0001C 13,26.3432 14.3432,25.0001 16,25.0001 Z M 20,34L 31.9999,34C 33.6567,34 34.9999,35.3432 34.9999,37C 34.9999,38.6569 33.6567,40 31.9999,40L 20,39.9999C 18.3431,39.9999 17,38.6568 17,36.9999C 17,35.3431 18.3431,34 20,34 Z M 46,23L 46,47L 71.832,47C 70.982,50.2035 69.6891,53.2267 68.0228,56L 42,56L 42,18L 66.7265,18C 67.8263,19.5768 68.7997,21.2484 69.6318,23L 46,23 Z M 52.4999,31.0001L 55,31L 55,30.5C 55,29.3955 56.3954,28 57.5,28L 60.5,28C 61.6045,28 63,29.3955 63,30.5L 63,31L 65.4999,31.0001C 66.8807,31.0001 67.9999,32.1194 67.9999,33.5001L 68,39.5C 68,40.8807 66.8807,42 65.5,42L 52.5,42C 51.1192,42 50,40.8807 50,39.5L 49.9999,33.5001C 49.9999,32.1194 51.1192,31.0001 52.4999,31.0001 Z M 52.9999,32.7501C 52.4477,32.7501 51.9999,33.1978 51.9999,33.75C 51.9999,34.3023 52.4477,34.75 52.9999,34.75C 53.5522,34.75 53.9999,34.3023 53.9999,33.75C 53.9999,33.1978 53.5522,32.7501 52.9999,32.7501 Z M 59,33C 57.3431,33 56,34.3432 56,36C 56,37.6569 57.3431,39 59,39C 60.6568,39 62,37.6569 62,36C 62,34.3432 60.6568,33 59,33 Z M 25,43L 33.9999,43.0001C 35.6567,43.0001 36.9999,44.3433 36.9999,46.0001C 36.9999,47.657 35.6567,49.0001 33.9999,49.0001L 25,49C 23.3431,49 22,47.6568 22,46C 22,44.3431 23.3431,43 25,43 Z "/>
                                </Canvas>
                            </Viewbox>
                        </Border>
                        <TextBlock Grid.Column="1"	Grid.Row="0" Margin="10,2" FontWeight="Bold" VerticalAlignment="Center"
								Foreground="#fff" Text="{Binding Converter={StaticResource valueConverter}, ConverterParameter=Title}"
                                   TextTrimming="CharacterEllipsis" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
